package peng.yang.express.VolleyUtils;

import android.util.Log;
import com.sortlistview.CharacterParser;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

import peng.yang.express.Bean.PhoneRequest;
import peng.yang.express.Bean.SortModel;

/**
 * Created by Administrator on 2016/6/27.
 */
public class JsonArrayToListcheck {
    JSONObject json = null;
    PhoneRequest sm = null;
    JSONArray ja;

    public JsonArrayToListcheck() {

    }

    public JsonArrayToListcheck(JSONArray ja) {
        this.ja = ja;

    }

    public  List<PhoneRequest> setJRToList() {

        List<PhoneRequest> list = new ArrayList<PhoneRequest>();

        for (int i = 0; i < ja.length(); i++) {
            try {
                sm = new PhoneRequest();
                json = ja.getJSONObject(i);
               sm.setState(json.getString("context"));
               sm.setTime(json.getString("time"));

                list.add(sm);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
            return list;
    }

}